
 class ListNode {
    int val;
    ListNode next = null;

    ListNode(int val) {
        this.val = val;
    }
}
public class Solution {
    public static ListNode Merge(ListNode list1,ListNode list2) {
        ListNode ret=new ListNode(-1);
         ListNode retu=ret;
        while(list1!=null&&list2!=null){
            if(list1.val<=list2.val){
                ret.next=list1;
                list1=list1.next;
            }else{
                 ret.next=list2;
                list2=list2.next;
            }
        }
        if(list1==null){
            ret.next=list2;
        }else{
            ret.next=list1;
        }
        return retu.next;
    }

    public static void main(String[] args) {
        Merge(new ListNode(1),new ListNode(2));
    }
}
